
package week9.homework;//******************************************************************************************
//  PalindromeTester.java     Author:Duanzhixuan
//  
//  Demonstrates the use of nested while loops.
//******************************************************************************************

import java.util.Scanner;

public class PalindromeTester
{
    //------------------------------------------------------------------------------------------
    //  Tests strings to see if they are palindromes.
    //-------------------------------------------------------------------------------------------
public static void main(String[] args) {
    String str, another = "y";
    int left, right;

    Scanner scan = new Scanner(System.in);
    System.out.println("请输入字符串");
    String an=scan.nextLine();
    System.out.println(PalindromeTester.abb(an,an.length()));

 }
static int a=0;

public static String abb(String num,int num1)
    {

        if (a==num1/2||a==num1/2-0.5||a==num1)
           return "输入的字符串是回文";
     else {
            if (num.charAt(0) == num.charAt(num.length()-1))
            {
            a++;
                return  abb(num.substring(1, num.length() - 1),num1);

            }
         else
            return "输入的字符串不是回文";
        }    }


}
